import 'package:flutter/material.dart';

/// todo：基础的行组件
rowBaseWidget({
  String? leftText,
  String? rightText,
  String? subLeftText,
  bool showLine = true,
  bool showRightIcon = true,
  Function()? onTap,
  Widget? left,
  Widget? right,
  double? height,
  EdgeInsetsGeometry? padding,
  EdgeInsetsGeometry? margin,
  int rightFlex:1,
  int leftFlex:1,
  MainAxisAlignment? mainAxisAlignment,
  CrossAxisAlignment? crossAxisAlignment,
  Color? bgColor,
}){
  return Padding(padding: margin ?? EdgeInsets.all(0),child: Material(
    color: bgColor ?? Colors.white,
    child: InkWell(
      child: Container(
        padding: padding ?? EdgeInsets.symmetric(vertical: 18),
        height: height,
        decoration: BoxDecoration(
          border: Border(bottom: BorderSide(color: showLine ? Colors.grey.shade200 : Colors.transparent), ),
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: crossAxisAlignment ?? CrossAxisAlignment.center,
          children: [
            left ?? Expanded(flex: leftFlex,child: Text("${leftText ?? ''}",style: TextStyle(color: Colors.black,fontSize: 14),),),
            right ?? Expanded(
              flex: rightFlex,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Expanded(child: Text("${rightText ?? ''}",style: TextStyle(color: Colors.black,fontSize: 14),maxLines: 2,overflow: TextOverflow.ellipsis,textAlign: TextAlign.end,),),
                  showRightIcon ? Icon(Icons.chevron_right,color:  Colors.grey.shade400,):SizedBox(),
                ],
              ),
            ),
          ],
        ),
      ),
      onTap: onTap ?? null,
    ),
  ),);
}